<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function* show() {
            alert('a');

            yield; // 放弃 暂时不往下执行

            alert('b');
        }

        let genObj = show();

        genObj.next();
        genObj.next();
    </script>
</body>

</html>